package Pet.Management.controller;

import Pet.Management.service.CaptchaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class CaptchaController {

    @Autowired
    private CaptchaService captchaService;

    @GetMapping("/api/captchaImage")
    public Map<String, Object> getCaptcha() {
        Map<String, Object> response = new HashMap<>();
        Map<String, Object> captcha = captchaService.createCaptcha();
        
        response.put("code", 200);
        response.put("msg", "操作成功");
        response.put("img", captcha.get("img"));
        response.put("uuid", captcha.get("uuid"));
        response.put("captchaEnabled", true);
        
        return response;
    }
} 